package serverMessage;
import time.LogicalTimeStamp;
import time.VectorTimeStamp;

/**
 * This is the only ServerMessage that carries a VectorTimeStamp
 *  to ensure that MERequest are delivered in causal order and 
 *  the only types of messages that's stored in the holdbackQueue
 */
public class RegisterMERequest extends ServerMessage{
	private static final long serialVersionUID = -5191281461234922364L;
	private String username;
	private VectorTimeStamp METime;
	
	public RegisterMERequest(VectorTimeStamp METime, String username, LogicalTimeStamp msgTS) {
		super(ServerMessage.REGISTER_ME_REQUEST, msgTS);
		this.METime = METime;
		this.username = username;
	}

	public String getUsername() {	return username;				}
	public VectorTimeStamp getME_TS(){	return this.METime;			}
	
	// the messageTS is the request time
	public LogicalTimeStamp getRequestTime(){ return super.getMessageTS();}
	
	public String toString() {
		return "RegisterMERequest: username=" + this.username + " requestTime=" + super.getMessageTS();
	}
	
}
